package ca.llsutherland.nfl.facade;

import ca.llsutherland.nfl.dao.RoleDao;
import ca.llsutherland.nfl.domain.Role;
import ca.llsutherland.nfl.exception.ValidationException;
import ca.llsutherland.nfl.persistence.ReadOnlyTransactionHandler;
import ca.llsutherland.nfl.persistence.Transaction;

public class FinderFacade extends BaseFacade {
	
	private ReadOnlyTransactionHandler readOnlyTransactionHandler = ReadOnlyTransactionHandler.getInstance();
	

	public Role findRoleByName(final String roleName) {
		Transaction t = new Transaction() {
            public Object executeTransaction() throws ValidationException {
                return RoleDao.getInstance().findByName(roleName);
            }
        };
        return (Role) this.readOnlyTransactionHandler.runTransaction(t);
	}

}
